CREATE TABLE "AC_ACCOUNT" 
(	"ACCOUNT_ID" NUMBER(*,0) NOT NULL ENABLE, 
	"SOURCE_OBJECT_ID" NUMBER(*,0) NOT NULL ENABLE, 
	"SOURCE_OBJECT_CODE" VARCHAR(20) NOT NULL ENABLE, 
	"LOCKED" CHAR(1) DEFAULT 'F' NOT NULL ENABLE, 
	"CREATION_DATE" TIMESTAMP (6) NOT NULL ENABLE, 
	"END_DATE" DATE, 
	"EXPIRY_DAYS" NUMBER
	);
 
COMMENT ON COLUMN "AC_ACCOUNT"."ACCOUNT_ID" IS 'Key de la cuenta';
 
COMMENT ON COLUMN "AC_ACCOUNT"."SOURCE_OBJECT_ID" IS 'Id externo que identifica al duenio de la cuenta';
 
COMMENT ON COLUMN "AC_ACCOUNT"."SOURCE_OBJECT_CODE" IS 'Codigo que identifica a la aplicacion que registro esta cuenta';
 
COMMENT ON COLUMN "AC_ACCOUNT"."LOCKED" IS 'Si la cuenta está lockeada o no.';
 
COMMENT ON COLUMN "AC_ACCOUNT"."CREATION_DATE" IS 'Fecha de creación de la cuenta.';
 
COMMENT ON TABLE "AC_ACCOUNT"IS 'Cuentas corrientes de los clientes.';
 
CREATE UNIQUE INDEX "AC_ACCOUNT_PK" ON "AC_ACCOUNT" ("ACCOUNT_ID");
 
CREATE UNIQUE INDEX "AC_ACCOUNT_UK1" ON "AC_ACCOUNT" ("SOURCE_OBJECT_ID", "SOURCE_OBJECT_CODE");
 
CREATE TABLE "AC_TRX" 
(	
	"TRX_ID" NUMBER(*,0) NOT NULL ENABLE, 
	"ACCOUNT_ID" NUMBER(*,0) NOT NULL ENABLE, 
	"TRX_DATE" TIMESTAMP (6) NOT NULL ENABLE, 
	"AMOUNT" NUMBER NOT NULL ENABLE, 
	"SOURCE_OBJECT_ID" NUMBER(*,0) NOT NULL ENABLE, 
	"SOURCE_OBJECT_CODE" VARCHAR(30) NOT NULL ENABLE, 
	 CONSTRAINT "AC_TRX_PK" PRIMARY KEY ("TRX_ID")
);
 
COMMENT ON COLUMN "AC_TRX"."TRX_ID" IS 'Key';
 
COMMENT ON COLUMN "AC_TRX"."ACCOUNT_ID" IS 'Cuenta en la que se genera esta trx.';
 
COMMENT ON COLUMN "AC_TRX"."TRX_DATE" IS 'Fecha / hora de la trx.';
 
COMMENT ON COLUMN "AC_TRX"."AMOUNT" IS 'Monto de la transacción. Positivo es un crédito y negativo un débito.';
 
COMMENT ON COLUMN "AC_TRX"."SOURCE_OBJECT_ID" IS 'ID del registro al que hace referencia esta transacción en la tabla especificada por SOURCE_OBJECT_CODE.';
 
COMMENT ON COLUMN "AC_TRX"."SOURCE_OBJECT_CODE" IS 'Nombre de la tabla que está asociada con esta transacción. Por ejemplo: código de prepago, orden (para los débitos), cupones (para los créditos), etc.';
 
COMMENT ON TABLE "AC_TRX"IS 'Historia de las transacciones sobre una cuenta.';
 
CREATE UNIQUE INDEX "AC_TRX_PK" ON "AC_TRX" ("TRX_ID");
 
CREATE INDEX "INDEX1" ON "AC_TRX" ("SOURCE_OBJECT_CODE", "SOURCE_OBJECT_ID");
 
CREATE OR REPLACE TRIGGER "AC_TRX_ID_TRG" 
BEFORE INSERT ON AC_TRX
FOR EACH ROW
DECLARE
ed date;
ld VARCHAR(1);
BEGIN
SELECT end_date, locked into ed, ld
from ac_account
where account_id = :new.account_id;
if ed is not null
then
 Raise_application_error( -20002, 'La cuenta ' || TO_CHAR( :new.account_id ) || ' esta borrada ');
end if;
if ld != 'F'
then
 Raise_application_error( -20002, 'La cuenta ' || TO_CHAR( :new.account_id ) || ' esta bloqueada');
end if;
SELECT AC_TRX_ID_SEQ.NEXTVAL INTO :NEW.TRX_ID FROM DUAL;
END;

/
ALTER TRIGGER "AC_TRX_ID_TRG" ENABLE;
 
CREATE TABLE "OR_ORGANIZATION" 
(	
 "ORGANIZATION_ID" NUMBER NOT NULL ENABLE, 
	"NAME" VARCHAR(100), 
	"SITE_URL" VARCHAR(100), 
	"LOCKED" VARCHAR(1) DEFAULT 'F', 
	"END_DATE" DATE, 
	);
 
CREATE TABLE "PG_TRANSACTION" 
(	"ID_TRANSACTION" NUMBER, 
	"USER_ID" NUMBER, 
	"ACCOUNT_ID" NUMBER, 
	"PAYMENT_METHOD_ID" NUMBER, 
	"OBJECT" CLOB
);
 
CREATE TABLE "PG_WEBPAY" 
(
 "ORDEN_COMPRA" NUMBER NOT NULL ENABLE, 
	"TIPO_TRANSACCION" VARCHAR(100), 
	"TBK_MONTO" VARCHAR(100), 
	"CODIGO_AUTORIZACION" VARCHAR(4000), 
	"FINAL_NUMERO_TARJETA" VARCHAR(4), 
	"TBK_TIPO_PAGO" VARCHAR(100), 
	"TBK_NUMERO_CUOTAS" NUMBER, 
	"TBK_RESPUESTA" NUMBER, 
	"TBK_FECHA_CONTABLE" VARCHAR(20), 
	"TBK_FECHA_TRANSACCION" VARCHAR(20), 
	"TBK_HORA_TRANSACCION" VARCHAR(100), 
	"TBK_ID_SESION" VARCHAR(4000), 
	"TBK_ID_TRANSACCION" VARCHAR(4000), 
	"TBK_TASA_INTERES_MAX" VARCHAR(40), 
	"TBK_MAC" VARCHAR(4000), 
	"TBK_ANIO_TRANSACCION" VARCHAR(4)
);
 
CREATE TABLE "POS_PREPAID_CODE" 
(	
	"ID" NUMBER, 
	"CODE" VARCHAR(20), 
	"STATUS" VARCHAR(1), 
	"EXP_DATE" DATE, 
	"VALUE" NUMBER, 
	"SOURCE_OBJECT_ID" NUMBER, 
	"SOURCE_OBJECT_CODE" VARCHAR(20), 
	"USED_DATE" DATE, 
	"DESTINATION_OBJECT_ID" NUMBER, 
	"DESTINATION_OBJECT_CODE" VARCHAR(20), 
	"END_DATE" DATE, 
	"CREATION_DATE" DATE
);
 
COMMENT ON COLUMN "POS_PREPAID_CODE"."ID" IS 'Unique id to use as pk';
 
COMMENT ON COLUMN "POS_PREPAID_CODE"."CODE" IS 'Encrypted code';
 
COMMENT ON COLUMN "POS_PREPAID_CODE"."STATUS" IS 'Status of this prepaid code';
 
COMMENT ON COLUMN "POS_PREPAID_CODE"."EXP_DATE" IS 'Expiration date';
 
COMMENT ON COLUMN "POS_PREPAID_CODE"."VALUE" IS 'The numeric value of this prepaid code';
 
COMMENT ON COLUMN "POS_PREPAID_CODE"."SOURCE_OBJECT_ID" IS 'The external id of the entity that create this prepaid code, could be a userid, etc';
 
COMMENT ON COLUMN "POS_PREPAID_CODE"."SOURCE_OBJECT_CODE" IS 'An external code that identifies the entity that create this code, like USER';
 
COMMENT ON COLUMN "POS_PREPAID_CODE"."USED_DATE" IS 'Date when the prepaid code was consumed';
 
COMMENT ON COLUMN "POS_PREPAID_CODE"."DESTINATION_OBJECT_ID" IS 'An extenal id of the entity that consumes this prepaid code';
 
COMMENT ON COLUMN "POS_PREPAID_CODE"."DESTINATION_OBJECT_CODE" IS 'An extenal code that identifies the the entity that consumes this prepaid code';
 
COMMENT ON COLUMN "POS_PREPAID_CODE"."END_DATE" IS 'If the code is deleted this field is not null and reperesent de deletion date';
 
COMMENT ON COLUMN "POS_PREPAID_CODE"."CREATION_DATE" IS 'Creation date of the prepaid code';
 
COMMENT ON TABLE "POS_PREPAID_CODE"IS 'Prepaid codes';
 
CREATE UNIQUE INDEX "PPC_PREPAID_CODE_PK" ON "POS_PREPAID_CODE" ("ID");
 
CREATE UNIQUE INDEX "PPC_PREPAID_CODE_UK1" ON "POS_PREPAID_CODE" ("CODE");
 
CREATE TABLE "PR_PERSONALIZED_PRODUCT" 
(	
 "PERSONALIZED_PRODUCT_ID" NUMBER(*,0) NOT NULL ENABLE, 
	"TEMPLATE_PRODUCT_ID" NUMBER(*,0), 
	"USER_ID" NUMBER(*,0), 
	"NAME" VARCHAR(100), 
	"CREATION_DATE" DATE, 
	"OBJECT" CLOB
	) ;
 
CREATE TABLE "PR_PRODUCT_TYPE" 
(	
	"PRODUCT_TYPE_ID" NUMBER NOT NULL ENABLE, 
	"NAME" VARCHAR(20), 
	"TAX_CLASS_ID" NUMBER, 
	"ORGANIZATION_ID" NUMBER DEFAULT NULL, 
	"LOCKED" VARCHAR(1) DEFAULT 'F' NOT NULL ENABLE, 
	"END_DATE" DATE
) ;
 
CREATE TABLE "PR_SESSION_PRODUCT" 
(	
	"PERSONALIZED_PRODUCT_ID" NUMBER(*,0) NOT NULL ENABLE, 
	"TOKEN" VARCHAR(200), 
	"CREATION_DATE" DATE
	
);
 
CREATE TABLE "PR_USER_IMAGE" 
(	
	"USER_IMAGE_ID" VARCHAR(32) NOT NULL ENABLE, 
	"PERSONALIZED_PRODUCT_ID" NUMBER(*,0), 
	"CREATION_DATE" DATE, 
	"OBJECT" CLOB, 
	);
 
CREATE TABLE "SC_ADDRESS" 
(
"ADDRESS_ID" NUMBER(*,0) NOT NULL ENABLE, 
	"CUSTOMER_ID" NUMBER(*,0) NOT NULL ENABLE, 
	"NAME" VARCHAR(50), 
	"ADDRESS1" VARCHAR(200), 
	"ADDRESS2" VARCHAR(200), 
	"STREET_NAME" VARCHAR(50), 
	"STREET_NUMBER" VARCHAR(20), 
	"APT_FLOOR" VARCHAR(20), 
	"ZIP_CODE" VARCHAR(50), 
	"ZONE_ID" NUMBER(*,0) NOT NULL ENABLE, 
	"IS_BILL_ADDRESS" NUMBER DEFAULT 0
);
 
CREATE TABLE "SC_PAYMENT_METHOD" 
(
 "PAYMENT_METHOD_ID" NUMBER NOT NULL ENABLE, 
	"PAYMENT_METHOD" VARCHAR(4000), 
	"TITLE" VARCHAR(4000), 
	"DESCRIPTION" VARCHAR(4000), 
	"URL_ACTION" VARCHAR(4000), 
	"URL_IMG" VARCHAR(4000), 
	"LOCKED" CHAR(4) DEFAULT 'F' NOT NULL ENABLE, 
	"TICKET" CHAR(1) DEFAULT 'T'
	);
 
COMMENT ON COLUMN "SC_PAYMENT_METHOD"."LOCKED" IS 'Si el metodo de pago está activo';
 
CREATE TABLE "SC_SALES_LINE_PROPERTY" 
(	
	"SALES_PROPERTY_ID" NUMBER NOT NULL ENABLE, 
	"SALES_LINE_ID" NUMBER NOT NULL ENABLE, 
	"PROPERTY" VARCHAR(4000) NOT NULL ENABLE, 
	"VALUE" VARCHAR(4000)
);
 
CREATE TABLE "SC_SALES_ORDER_HDR" 
(	
 "SALES_ORDER_ID" NUMBER(*,0) NOT NULL ENABLE, 
	"CUSTOMER_ID" NUMBER(*,0) NOT NULL ENABLE, 
	"SHIPPING_METHOD_ID" NUMBER(*,0), 
	"ORDER_SHIPPING_COST" NUMBER, 
	"TOTAL_SHIPPING_COST" NUMBER DEFAULT 0 NOT NULL ENABLE, 
	"TOTAL_AMOUNT" NUMBER, 
	"SHIP_TO_ADDRESS_ID" NUMBER(*,0) DEFAULT 0, 
	"BILL_TO_ADDRESS_ID" NUMBER(*,0) DEFAULT 0, 
	"CONTACT_PHONE" VARCHAR(30), 
	"PAYMENT_METHOD_ID" NUMBER(*,0), 
	"PAY_DATE" TIMESTAMP (6), 
	"STATUS" VARCHAR(20) DEFAULT 'A' NOT NULL ENABLE, 
	"LAST_MODIFICATION" TIMESTAMP (6), 
	"ACCOUNT_ID" VARCHAR(20)
	
	);
 
COMMENT ON COLUMN "SC_SALES_ORDER_HDR"."SALES_ORDER_ID" IS 'Unique id for this order.';
 
COMMENT ON COLUMN "SC_SALES_ORDER_HDR"."CUSTOMER_ID" IS 'Customer id who owns this sales order.';
 
COMMENT ON COLUMN "SC_SALES_ORDER_HDR"."SHIPPING_METHOD_ID" IS 'Id of shipping method chosen.';
 
COMMENT ON COLUMN "SC_SALES_ORDER_HDR"."ORDER_SHIPPING_COST" IS 'Additional shipping costs.';
 
COMMENT ON COLUMN "SC_SALES_ORDER_HDR"."TOTAL_SHIPPING_COST" IS 'Total shipping cost for this order. Calculated from lines plus the ORDER_SHIPPING_CART.';
 
COMMENT ON COLUMN "SC_SALES_ORDER_HDR"."TOTAL_AMOUNT" IS 'Total amount with taxes. Calculated from lines.';
 
COMMENT ON COLUMN "SC_SALES_ORDER_HDR"."SHIP_TO_ADDRESS_ID" IS 'Address where this order should be shipped to.';
 
COMMENT ON COLUMN "SC_SALES_ORDER_HDR"."BILL_TO_ADDRESS_ID" IS 'Address where the bill should be shipped to.';
 
COMMENT ON COLUMN "SC_SALES_ORDER_HDR"."CONTACT_PHONE" IS 'Contact phone number.';
 
COMMENT ON COLUMN "SC_SALES_ORDER_HDR"."PAYMENT_METHOD_ID" IS 'Id of type of payment. Description comes from sys_multivalue type = ''PAYMENT_METHOD''.';
 
COMMENT ON COLUMN "SC_SALES_ORDER_HDR"."PAY_DATE" IS 'Date and time this order was payed. NULL means its not payed yet.';
 
COMMENT ON COLUMN "SC_SALES_ORDER_HDR"."STATUS" IS 'Status for this order. References table SYS_LOV with type = ''ORDER_STATUS''.';
 
COMMENT ON COLUMN "SC_SALES_ORDER_HDR"."LAST_MODIFICATION" IS 'Date and time when the order was created.';
 
COMMENT ON COLUMN "SC_SALES_ORDER_HDR"."ACCOUNT_ID" IS 'Account Id asociada aluusuario	 ';
 
COMMENT ON TABLE "SC_SALES_ORDER_HDR"IS 'This table saves stores all information regarding a users shopping cart. When the user adds a product the sales cart a new order is created and the status set to ''A''. When the customer finally pays the order its PAY_DATE is set and state changed to ''P''.';
 
CREATE INDEX "SC_SALES_ORDER_HDR_INDEX1" ON "SC_SALES_ORDER_HDR" ("CUSTOMER_ID") 
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "POD_QA" ;
 
CREATE INDEX "SC_SALES_ORDER_HDR_INDEX2" ON "SC_SALES_ORDER_HDR" ("PAY_DATE") 
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "POD_QA" ;
 
CREATE UNIQUE INDEX "SC_SALES_ORDER_HDR_PK" ON "SC_SALES_ORDER_HDR" ("SALES_ORDER_ID") 
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "POD" ;
 
CREATE TABLE "SC_SALES_ORDER_HDR_PROPERTY" 
(	"SALES_ORDER_HDR_PROPERTY_ID" NUMBER NOT NULL ENABLE, 
	"SALES_ORDER_ID" NUMBER NOT NULL ENABLE, 
	"PROPERTY" VARCHAR(4000) NOT NULL ENABLE, 
	"VALUE" VARCHAR(4000) NOT NULL ENABLE, 
	 CONSTRAINT "SC_SALES_ORDER_HDR_PROPER_PK" PRIMARY KEY ("SALES_ORDER_HDR_PROPERTY_ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "ECART"ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "ECART" ;
 
CREATE TABLE "SC_SALES_ORDER_LINE" 
(	"SALES_LINE_ID" NUMBER(*,0) NOT NULL ENABLE, 
	"SALES_ORDER_ID" NUMBER(*,0) NOT NULL ENABLE, 
	"PRODUCT_ID" NUMBER(*,0) NOT NULL ENABLE, 
	"PRODUCT_TYPE" VARCHAR(20), 
	"PRODUCT_DESCRIPTION" VARCHAR(200) NOT NULL ENABLE, 
	"PRODUCT_DETAIL" VARCHAR(200), 
	"ORDERED_QUANTITY" NUMBER(*,0) DEFAULT 1 NOT NULL ENABLE, 
	"UNIT_SELLING_PRICE" NUMBER NOT NULL ENABLE, 
	"UNIT_SHIPPING_PRICE" NUMBER, 
	"UNIT_FINAL_PRICE" NUMBER NOT NULL ENABLE, 
	"LINE_ORDER" NUMBER(*,0), 
	"PCNT_TAX" NUMBER DEFAULT 0 NOT NULL ENABLE, 
	"SALES_LINE_TYPE" VARCHAR(20) DEFAULT 'PRODUCT' NOT NULL ENABLE, 
	 CONSTRAINT "SC_SALES_ORDER_LINE_PK" PRIMARY KEY ("SALES_LINE_ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "POD"ENABLE, 
	 CONSTRAINT "SC_SALES_ORDER_FK1" FOREIGN KEY ("SALES_ORDER_ID")
	REFERENCES "SC_SALES_ORDER_HDR" ("SALES_ORDER_ID") ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "POD" ;
 
COMMENT ON COLUMN "SC_SALES_ORDER_LINE"."SALES_LINE_TYPE" IS 'The type of line: product, discount, pmethod_charge, shipping_cost';
 
CREATE TABLE "SC_SALES_ORDER_PAY" 
(	"SALES_ORDER_PAY_ID" NUMBER(*,0) NOT NULL ENABLE, 
	"SALES_ORDER_ID" NUMBER(*,0) NOT NULL ENABLE, 
	"USER_ID" NUMBER(*,0) NOT NULL ENABLE, 
	"REFERAL_CODE" VARCHAR(100) DEFAULT 0, 
	"PAY_DATE" DATE NOT NULL ENABLE, 
	"BRANCH_ID" NUMBER(*,0) NOT NULL ENABLE, 
	 CONSTRAINT "SC_SALES_ORDER_PAY_UK1" UNIQUE ("SALES_ORDER_PAY_ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "POD_QA"ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "POD_QA" ;
 
COMMENT ON COLUMN "SC_SALES_ORDER_PAY"."USER_ID" IS 'Id del usuario que efectuo el cobro';
 
COMMENT ON COLUMN "SC_SALES_ORDER_PAY"."REFERAL_CODE" IS 'Codigo de referencia, el cual puede estar relacionado con el numero de factura emitida	';
 
COMMENT ON COLUMN "SC_SALES_ORDER_PAY"."PAY_DATE" IS 'FECHA de la realizacion del pago';
 
COMMENT ON COLUMN "SC_SALES_ORDER_PAY"."BRANCH_ID" IS 'Sucursal en la que fue vendido el produco';
 
 
CREATE TABLE "SC_SHIPPING_COST" 
(	"SHIPPING_ZONE_ID" NUMBER NOT NULL ENABLE, 
	"DATE_FROM" DATE, 
	"DATE_TO" DATE, 
	"DEFAULT_COST" NUMBER, 
	"ADDITIONAL_COST_ITEM" NUMBER, 
	"ACTIVE" CHAR(1), 
	"SHIPPING_COST_ID" NUMBER NOT NULL ENABLE, 
	"LOCKED" VARCHAR(1) DEFAULT 'F' NOT NULL ENABLE, 
	"END_DATE" DATE, 
	 CONSTRAINT "SC_SHIPPING_COST_PK" PRIMARY KEY ("SHIPPING_ZONE_ID")
);
 
CREATE TABLE "SC_SHIPPING_METHOD" 
(	"SHIPPING_METHOD_ID" NUMBER(*,0) NOT NULL ENABLE, 
	"METHOD" VARCHAR(4000), 
	"PRIORITY" NUMBER DEFAULT 0, 
	"LOCKED" VARCHAR(1) DEFAULT 'F' NOT NULL ENABLE, 
	"END_DATE" DATE, 
	"LOGO" VARCHAR(100), 
);
 
COMMENT ON COLUMN "SC_SHIPPING_METHOD"."PRIORITY" IS 'Priority of the Shipping method	';
 
CREATE TABLE "SC_TAX_CLASS" 
(	"TAX_CLASS_ID" NUMBER NOT NULL ENABLE, 
	"TITLE" VARCHAR(100), 
	"DESCRIPTION" VARCHAR(255), 
	"LOCKED" VARCHAR(1) DEFAULT 'F' NOT NULL ENABLE, 
	"END_DATE" DATE, 
	 CONSTRAINT "SC_TAX_CLASS_PK" PRIMARY KEY ("TAX_CLASS_ID")
) ;
 
CREATE TABLE "SC_TAX_RATE" 
(	"TAX_RATE_ID" NUMBER NOT NULL ENABLE, 
	"TAX_CLASS_ID" NUMBER, 
	"PRIORITY" NUMBER, 
	"RATE" VARCHAR(20), 
	"DESCRIPTION" VARCHAR(20), 
	"LOCKED" VARCHAR(1) DEFAULT 'F' NOT NULL ENABLE, 
	"END_DATE" DATE, 
	 CONSTRAINT "SC_TAX_RATE_PK" PRIMARY KEY ("TAX_RATE_ID")
) ;
 
CREATE TABLE "SC_ZONE" 
(	"ZONE_ID" NUMBER(*,0) NOT NULL ENABLE, 
	"PARENT_ZONE_ID" NUMBER(*,0) NOT NULL ENABLE, 
	"NAME" VARCHAR(50) NOT NULL ENABLE, 
	"LOCKED" VARCHAR(1) DEFAULT 'F' NOT NULL ENABLE, 
	"END_DATE" DATE, 
	"SHIPPING_ZONE_ID" NUMBER, 
	 CONSTRAINT "SC_STATES_PK" PRIMARY KEY ("ZONE_ID")

)  ;
 
COMMENT ON COLUMN "SC_ZONE"."ZONE_ID" IS 'ID for this zone.';
 
COMMENT ON COLUMN "SC_ZONE"."PARENT_ZONE_ID" IS 'ID of parent zone';
 
COMMENT ON COLUMN "SC_ZONE"."NAME" IS 'Name for this Zone';
 
COMMENT ON TABLE "SC_ZONE"IS 'Zones are geographical regions. Examples of zones are: countries, states, counties, cities, etc. They have a hierarchical structure and a level. Level 0 is the top level. For example: level 0 is the country, level 1 is the state, level 2 is the county and level 3 the state.';
 

 
CREATE TABLE "SC_ZONE_COST" 
(	
	"SHIPPING_COST_ID" NUMBER NOT NULL ENABLE, 
	"ZONE_ID" NUMBER NOT NULL ENABLE, 
	"SHIPPING_METHOD_ID" NUMBER NOT NULL ENABLE, 
	 CONSTRAINT "SC_ZONE_COST_PK" PRIMARY KEY ("SHIPPING_COST_ID")
);
 



